package avicit.bdp.dds.dao.entity;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import avicit.platform6.core.properties.PlatformConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;

@ApiModel(value = "AlgoNodes", description = "bdp_dds_algo_nodes")
@Table(name = "bdp_dds_algo_nodes")
public class AlgoNodes extends BaseDTO {
    private static final long serialVersionUID = 1L;

    @Transient
    public static Integer OPEN_PRIVATE = 0;//私有
    @Transient
    public static Integer OPEN_SHARE = 1;//共享
    @Transient
    public static Integer OPEN_ADDUCTION = 2;//引用

    /**
     * 主键
     */
    @Id
    @LogField
    @ApiModelProperty(value = "id", name = "id")
    @FieldRemark(column = "id", field = "id", name = "主键")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    /**
     * 节点名称
     */
    @LogField
    @ApiModelProperty(value = "节点名称", name = "name")
    @FieldRemark(column = "name", field = "name", name = "节点名称")
    private String name;

    /**
     * 程序类型 spark执行节点：(0-- java;1--  scala;2--  python); 5--python执行节点
     */
    @LogField
    @ApiModelProperty(value = "程序类型 0-- java;1--  scala;2--  python", name = "programType")
    @FieldRemark(column = "program_type", field = "programType", name = "程序类型")
    private Integer programType;

    /**
     * 类名称
     */
    @LogField
    @ApiModelProperty(value = "类名称", name = "className")
    @FieldRemark(column = "class_name", field = "className", name = "类名称")
    private String className;

    /**
     * 是否共享：0--不共享；1--共享 ； 2--引用
     */
    @LogField
    @ApiModelProperty(value = "是否共享：0--不共享；1--共享", name = "open")
    @FieldRemark(column = "open", field = "open", name = "是否共享")
    private Integer open;

    /**
     * 备注
     */
    @LogField
    @ApiModelProperty(value = "备注", name = "remark")
    @FieldRemark(column = "remark", field = "remark", name = "备注")
    private String remark;

    /**
     * 内容
     */
    //@LogField
    @ApiModelProperty(value = "内容", name = "content")
    //@FieldRemark(column = "content", field = "content", name = "内容")
    private String content;

    /**
     * 资源id
     */
    @ApiModelProperty(value = "资源id", name = "resourceId")
    //@FieldRemark(column = "resource_id", field = "resourceId", name = "资源id")
    private String resourceId;

    /**
     * 原算法库Id
     */
    @ApiModelProperty(value = "原算法库Id", name = "sourceId")
    //@FieldRemark(column = "source_id", field = "sourceId", name = "原算法库Id")
    private String sourceId;

    /**
     * 参数json
     */
    @ApiModelProperty(value = "参数json", name = "params")
    //@FieldRemark(column = "params", field = "params", name = "参数json")
    private String params;

    /**
     * 代码
     */
    @LogField
    @ApiModelProperty(value = "代码", name = "code")
    @FieldRemark(column = "code", field = "code", name = "代码")
    private String code;

    /**
     * 图标
     */
    @LogField
    @ApiModelProperty(value = "图标", name = "icon")
    @FieldRemark(column = "icon", field = "icon", name = "图标")
    private String icon;

    /**
     * 备注
     */
    @LogField
    @ApiModelProperty(value = "颜色", name = "color")
    @FieldRemark(column = "color", field = "color", name = "颜色")
    private String color;

    /**
     * 节点包路径
     */
    @LogField
    @ApiModelProperty(value = "节点包路径", name = "node_file_path")
    @FieldRemark(column = "node_file_path", field = "node_file_path", name = "节点包路径")
    private String nodeFilePath;

    /**
     * 排序
     */
    @LogField
    @ApiModelProperty(value = "排序", name = "orderBy")
    @FieldRemark(column = "orderBy", field = "order_by", name = "排序")
    private Integer orderBy;

    /**
     * 分类ID
     */
    @Transient
    private String typeId;

    /**
     * 工程ID
     */
    @Transient
    private String projectId;

    /**
     * 用户名
     */
    @Transient
    private String username;
    /**
     * 文件名称
     */
    @Transient
    private String fileName;


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getProgramType() {
        return programType;
    }

    public void setProgramType(Integer programType) {
        this.programType = programType;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public Integer getOpen() {
        return open;
    }

    public void setOpen(Integer open) {
        this.open = open;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getResourceId() {
        return resourceId;
    }

    public void setResourceId(String resourceId) {
        this.resourceId = resourceId;
    }

    public String getSourceId() {
        return sourceId;
    }

    public void setSourceId(String sourceId) {
        this.sourceId = sourceId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getParams() {
        return params;
    }

    public void setParams(String params) {
        this.params = params;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getNodeFilePath() {
        return nodeFilePath;
    }

    public void setNodeFilePath(String nodeFilePath) {
        this.nodeFilePath = nodeFilePath;
    }

    public Integer getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(Integer orderBy) {
        this.orderBy = orderBy;
    }

    public String getTypeId() {
        return typeId;
    }

    public void setTypeId(String typeId) {
        this.typeId = typeId;
    }

    public String getProjectId() {
        return projectId;
    }

    public void setProjectId(String projectId) {
        this.projectId = projectId;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "算法库管理模块";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "算法库管理";
        } else {
            return super.logTitle;
        }
    }

    @Override
    public PlatformConstant.LogType getLogType() {
        if (super.logType == null) {
            return PlatformConstant.LogType.module_operate;
        } else {
            return super.logType;
        }
    }

    @Override
    public String toString() {
        return "AlgoNodes{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", programType=" + programType +
                ", className='" + className + '\'' +
                ", open=" + open +
                ", remark='" + remark + '\'' +
                ", content='" + content + '\'' +
                ", resourceId='" + resourceId + '\'' +
                ", sourceId='" + sourceId + '\'' +
                ", params='" + params + '\'' +
                ", code='" + code + '\'' +
                ", icon='" + icon + '\'' +
                ", color='" + color + '\'' +
                ", nodeFilePath='" + nodeFilePath + '\'' +
                ", orderBy=" + orderBy +
                ", typeId='" + typeId + '\'' +
                ", projectId='" + projectId + '\'' +
                ", username='" + username + '\'' +
                ", fileName='" + fileName + '\'' +
                '}';
    }
}
